home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / actlib17 / bctools.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-01  |  4.4 KB  |  168 lines

  1.                 /***     Tools for Borland C only   ***/
  2.  
  3.  
  4.  
  5.  
  6. #ifndef __ToolsIo_H
  7. #define __ToolsIo_H
  8.  
  9. #include "c2cpp.h"
  10. #include "tools.h"
  11. #include "key.h"
  12.  
  13.  
  14. /***
  15.  *  Function    :  listfile
  16.  *
  17.  *  Description :  Display a file on screen with pause
  18.  *               after each screen.
  19.  *
  20.  *  Parameters  :  in   char *filename
  21.  *
  22.  *  Decisions   :  If Esc or Ctrl-C is pressed, return immediately
  23.  *
  24.  *  Return code :   0 if OK
  25.  *                 -1 if error
  26.  *                
  27.  *  OS/Compiler :  MS-DOS & Turbo-C
  28.  ***/
  29.  
  30. EXTERN int listfile( char *filename );
  31.  
  32.  
  33.  
  34. /***
  35.  *  Function    :  border
  36.  *
  37.  *  Description :  Draw double lines border.
  38.  *
  39.  *  Parameters  :  in   int  left, top, right, bottom   border position
  40.  *
  41.  *  Decisions   :  Column range is [1-80]
  42.  *                 Line   range is [1-25]
  43.  *                 If right or bottom = 0, window limit is assumed.
  44.  *
  45.  *  Return code :  none
  46.  *
  47.  *  OS/Compiler :  MS-DOS & Turbo-C
  48.  ***/
  49.  
  50. EXTERN void border( int left, int top, int right, int bottom );
  51.  
  52.  
  53. /***
  54.  *  Function    :   input_date
  55.  *
  56.  *  Description :   Input day, month and year at given position.
  57.  *
  58.  *  Parameters  :   in   int *  day
  59.  *                  in   int *  month
  60.  *                  in   int *  year
  61.  *                  in   int    xpos
  62.  *                  in   int    ypos
  63.  *
  64.  *  Decisions   :   Default = current date
  65.  *            Century may be omitted.
  66.  *            Colors = white on blue
  67.  *        
  68.  *  Return      :    0 if OK
  69.  *                  -1 if no input
  70.  *
  71.  *  OS/Compiler :   MS-DOS & Turbo-C
  72.  ***/
  73.  
  74. EXTERN int input_date( int *day, int *month  , int *year, int xpos, int ypos );
  75.  
  76.  
  77.  
  78. /***
  79.  *  Function    :   input_time
  80.  *
  81.  *  Description :   Input hours and minutes at given position.
  82.  *
  83.  *  Parameters  :   in   int *  hour
  84.  *                  in   int *  min
  85.  *                  in   int *  sec
  86.  *                  in   int    xpos
  87.  *                  in   int    ypos
  88.  *
  89.  *  Decisions   :   Default = current hour and minutes
  90.  *                            if minutes are not given, 0 is assumed
  91.  *            Colors = white on blue
  92.  *        
  93.  *  Return      :    0 if OK
  94.  *                  -1 if no input
  95.  *
  96.  *  OS/Compiler :   MS-DOS & Turbo-C
  97.  ***/
  98.  
  99. EXTERN int input_time( int *hour, int *min, int xpos, int ypos );
  100.  
  101.  
  102. /***
  103.  *  Function    :   inputs
  104.  *
  105.  *  Description :   Input a string from keyboard
  106.  *
  107.  *  Parameters  :   in/out   char * data        default and result
  108.  *                  in       int    maxLen      maximum length to accept
  109.  *                  in       int    timeout     maximum time (seconds) waiting
  110.  *                                              before a key is pressed
  111.  *
  112.  *
  113.  *  Decisions   :   Valid keys:   Home         Begin of line
  114.  *                          End          End of line
  115.  *                                Left/Right   One character left/right
  116.  *                          Insert       Toggle isert on/off
  117.  *                                Delete       Delete current  character
  118.  *                                BackSpace    Delete previous character
  119.  *                          Ctrl-home    Erase to begin-of-line
  120.  *                          Ctrl-end     Erase to end-of-line
  121.  *                                Escape       Erase whole input
  122.  *                                Enter        Accept input
  123.  *
  124.  *                  Default string is erase if another input is given.
  125.  *                  (if any non-editing character is hit).
  126.  *        
  127.  *                  If no key is hit before timeout (in seconds)
  128.  *                  the function returns.
  129.  *                  timeout -1 means no timeout.
  130.  *                  timeout  0 means check for type-ahead.
  131.  *
  132.  *  Return      :   length of input
  133.  *
  134.  *  OS/Compiler :   MS-DOS & Turbo-C
  135.  ***/
  136.  
  137. EXTERN int inputs( char *data, int maxLen, int timeout );
  138.  
  139.  
  140.  
  141. typedef struct { char *title ;
  142.                  char x , y , width , height ;
  143.                  int  index , items , *quickshot ;
  144.                  int cursor ;
  145.                  char buffer[81] ;
  146.                  int  redraw , wait ;
  147.                  char * (*getentry)() ;
  148.                  int    (*match)() ;
  149.                } Menu ;
  150.  
  151. /***
  152.  *
  153.  *   M_get_item
  154.  *
  155.  *   Returns index of choice
  156.  *           -1 if no key hitten
  157.  *           -2 if none selected (ESC pressed)
  158.  *           -3 if none selected (CTRL_C pressed)
  159.  *
  160.  ***/
  161.  
  162. EXTERN int M_get_item( Menu *menu );
  163.  
  164. EXTERN void M_redraw( Menu *menu, int index );
  165.  
  166.  
  167. #endif
  168.